const logger = require('../logger');
module.exports={
    unLogin: (req,res,next) => {
        if(!req.session){
            logger.error('req.session is '+ req.session);
        }
        if(!req.session.token){
            res.redirect('/login');
        }else{
            next()
        }
    },
    logined: (req,res,next) => {
        if(req.session.token){
            res.redirect('/');
        }else{
            next()
        }
    }
};